# 定义person类
# class Person():
#
#     # 构造函数，用于为成员变量赋初始值
#     def __init__(self, name, age, height):
#         self.name = name
#         self.__age = age
#         self.height = height
#
#     def set_age(self, age):
#         if age < 0 or age > 150:
#             raise Exception("非法入参，年龄不合法")
#         self.__age = age
#
#     def introduce_self(self):
#         print("hello,my name is %s,my age is %d and i'm %d height" % (self.name, self.age, self.height))
#
#
# person = Person("cendy", 25, 175)
# print(person.age)


# 定义person类
# class Person():
#
#     # 构造函数，用于为成员变量赋初始值
#     def __init__(self, name, age, height):
#         self.name = name
#         self.__age = age
#         self.height = height
#
#     def set_age(self, age):
#         if age < 0 or age > 150:
#             raise Exception("非法入参，年龄不合法")
#         self.__age = age
#
#     def __introduce_self(self):
#         print("hello,my name is %s,my age is %d and i'm %d height" % (self.name, self.age, self.height))
#
#
# person = Person("cendy", 25, 175)
# person.__introduce_self()


# 定义person类
# class Person():
#
#     # 构造函数，用于为成员变量赋初始值
#     def __init__(self, name, age, height):
#         self.name = name
#         self.__age = age
#         self.height = height
#
#     def set_age(self, age):
#         if age < 0 or age > 150:
#             raise Exception("非法入参，年龄不合法")
#         self.__age = age
#
#     def introduce_self(self):
#         print("hello,my name is %s,my age is %d and i'm %d height" % (self.name, self.age, self.height))
#
#
# person = Person("cendy", 25, 175)
# person.__age = -1
# print(person.__age)
# print(person.__dict__)


# 定义person类
# class Person():
#
#     # 构造函数，用于为成员变量赋初始值
#     def __init__(self, name, age, height):
#         self.name = name
#         self.__age__ = age
#         self.height = height
#
#     def set_age(self, age):
#         if age < 0 or age > 150:
#             raise Exception("非法入参，年龄不合法")
#         self.__age__ = age
#
#     def introduce_self(self):
#         print("hello,my name is %s,my age is %d and i'm %d height" % (self.name, self.age, self.height))
#
#
# person = Person("cendy", 25, 175)
# print(person.__age__)


# 定义person类
class Person():

    # 构造函数，用于为成员变量赋初始值
    def __init__(self, name, age, height):
        self.name = name
        self.__age = age
        self.height = height

    def set_age(self, age):
        if age < 0 or age > 150:
            raise Exception("非法入参，年龄不合法")
        self.__age = age

    def introduce_self(self):
        print("hello,my name is %s,my age is %d and i'm %d height" % (self.name, self.age, self.height))


person = Person("cendy", 25, 175)
# 打破访问限制
print(person._Person__age)
